from django.shortcuts import render,redirect
from django.core.urlresolvers import reverse
from django.http import JsonResponse
from .functions import *
from .models import *


# 联系我们
def contact(request):
    mess = get_messages(request)
    return render(request, 'contact/contact.html', locals())

# 表单提交
def contact_post(request):
    # 检验表单提交的数据
    if check_contact_post(request):
        # 检验成功，存入数据库
        try:
            Contact.objects.save_contact_message(request)
            return JsonResponse({"ret":1})
        except:
            pass

